import { registerMicroApps, addGlobalUncaughtErrorHandler, start } from 'qiankun'
import { appArr } from './route'

registerMicroApps(appArr)
//启动 qiankun
console.log("qiankun启动了");
start({
  prefetch: 'all', //预加载
  sandbox: {
    experimentalStyleIsolation: true  //开启沙箱模式
  }
})

// 添加全局的未捕获异常处理器
addGlobalUncaughtErrorHandler((event) => {
  // @ts-ignore
  const { message } = event
  if (message && message.includes('died in status LOADING_SOURCE_CODE')) {
    console.error('微应用加载失败', event)
  }
})
